package com.demo2;


/**
 * @author zhoujun
 * @date 2025/3/26 23:41
 */
public class ConcreteMediatorClient {
    public static void main(String[] args) {

        //创建一个中介者对象
        ConcreteMediator mediator = new ConcreteMediator();

        ConcreteColleagueA colleagueA = new ConcreteColleagueA(mediator);
        ConcreteColleagueB colleagueB = new ConcreteColleagueB(mediator);
        ConcreteColleagueC colleagueC = new ConcreteColleagueC(mediator);

        mediator.register(colleagueA,colleagueB,colleagueC); //同事A可以转发给同事B和同事C
        mediator.register(colleagueB,colleagueC); //同事B可以转发给同事C
        mediator.register(colleagueC,colleagueA); //同事C可以转发给同事A

        colleagueA.send("你好,我是同事A");
        colleagueB.send("你好,我是同事B");
        colleagueC.send("你好,我是同事C");

    }
}
